From f18a9f081a8c52e27d50741a84e638de32ba914f Mon Sep 17 00:00:00 2001 From: Shinjiman Date: Fri, 26 Jun 2009 21:58:34 +0000 Subject: [PATCH] * (bug 14611) Added support showing the version of the image thumbnailing engine. --- RELEASE-NOTES | 3 ++- includes/specials/SpecialVersion.php | 34 ++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 06fdbc1905..293e4ade1a 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -91,7 +91,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN stripped from them. * Added a PHP port of CDB (constant database), for improved local caching when the DBA extension is not available. - +* (bug 14611) Added support showing the version of the image thumbnailing + engine. === Bug fixes in 1.16 === diff --git a/includes/specials/SpecialVersion.php b/includes/specials/SpecialVersion.php index 62cbac8d79..4a12d57dbe 100644 --- a/includes/specials/SpecialVersion.php +++ b/includes/specials/SpecialVersion.php @@ -43,6 +43,18 @@ class SpecialVersion extends SpecialPage { $wgOut->addHTML( '' ); } + /** + * execuate command for output + * @param string command + * @return string output + */ + function execOutput( $cmd ) { + $out = array( $cmd ); + exec( $cmd.' 2>&1', $out ); + unset($out[0]); + return implode("\n", $out ); + } + /**#@+ * @private */ @@ -88,6 +100,7 @@ class SpecialVersion extends SpecialPage { * @return wiki text showing the third party software versions (apache, php, mysql). */ static function softwareInformation() { + global $wgUseImageMagick, $wgImageMagickConvertCommand; $dbr = wfGetDB( DB_SLAVE ); // Put the software in an array of form 'name' => 'version'. All messages should @@ -98,6 +111,27 @@ class SpecialVersion extends SpecialPage { $software['[http://www.php.net/ PHP]'] = phpversion() . " (" . php_sapi_name() . ")"; $software[$dbr->getSoftwareLink()] = $dbr->getServerVersion(); + // Look for ImageMagick's version, if did not found, try to find the GD library version + if ( $wgUseImageMagick === true ) { + if ( file_exists( $wgImageMagickConvertCommand ) ) { + $swImageMagickInfo = self::execOutput( $wgImageMagickConvertCommand . ' -version' ); + list( $head, $tail ) = explode( 'ImageMagick', $swImageMagickInfo ); + list( $swImageMagickVer ) = explode('http://www.imagemagick.org', $tail ); + $software['[http://www.imagemagick.org/ ImageMagick]'] = $swImageMagickVer; + } + } else { + if( function_exists( 'gd_info' ) ) { + $gdInfo = gd_info(); + if ( strstr( $gdInfo['GD Version'], 'bundled' ) !== '' ) { + $gd_URL = 'http://www.php.net/gd'; + } + else { + $gd_URL = 'http://www.libgd.org'; + } + $software['[' . $gd_URL . ' GD library]'] = $gdInfo['GD Version']; + } + } + // Allow a hook to add/remove items wfRunHooks( 'SoftwareInfo', array( &$software ) ); -- 2.20.1